package com.bookyourtrek.action;


import java.math.BigInteger;
import java.sql.SQLException;
import java.util.List;

import com.bookyourtrek.model.HomeModel;
import com.bookyourtrek.model.LoginModel;
import com.bookyourtrek.model.TicketModel;
import com.bookyourtrek.model.TrekModel;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author /ananda
 * @category general 
 */
public class HomeAction extends ActionSupport {
	private static final long serialVersionUID = 1L;

	private List<String> locations;
	private BigInteger totalticketssold;
	private BigInteger totaladventuresorganized;
	private BigInteger totalusers;
	
	public BigInteger getTotalusers() {
		return totalusers;
	}


	public void setTotalusers(BigInteger totalusers) {
		this.totalusers = totalusers;
	}


	public BigInteger getTotalticketssold() {
		return totalticketssold;
	}


	public void setTotalticketssold(BigInteger totalticketssold) {
		this.totalticketssold = totalticketssold;
	}


	public BigInteger getTotaladventuresorganized() {
		return totaladventuresorganized;
	}


	public void setTotaladventuresorganized(BigInteger totaladventuresorganized) {
		this.totaladventuresorganized = totaladventuresorganized;
	}


	public List<String> getLocations() {
		return locations;
	}


	public void setLocations(List<String> locations) {
		this.locations = locations;
	}

	public String execute() throws SQLException {
		//get list of countries to populate the country dropdown
		HomeModel hm = new HomeModel();
		locations = hm.getcountrylist();
		
		//get the total no. of ticket sold
		TicketModel ticketmodel = new TicketModel();
		totalticketssold = ticketmodel.gettotalticketssold();
		
		//get total adventures created
		TrekModel trekmodel = new TrekModel();
		totaladventuresorganized = trekmodel.gettotaltrek();
		
		//get total users
		LoginModel loginmodel = new LoginModel();
		totalusers = loginmodel.gettotalusers();
		
		return SUCCESS;
		
	}
}
